package com.quectel.core.module.ai.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.quectel.core.module.ai.entity.AiLibApplicationEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author rananxin
 * @date 2021-11-24 19:15:08
 */

public interface AiLibApplicationDao extends BaseMapper<AiLibApplicationEntity> {
    /**
     * 查询列表
     *
     * @param params
     * @return
     */
    List<AiLibApplicationEntity> queryList(Map<String, Object> params);

    /**
     * 查询数量
     *
     * @param params
     * @return
     */
    int queryTotal(Map<String, Object> params);

    @Select("<script>select a.*, la.id ref_id, la.code, la.task_id, la.ai_control_lib_id, la.application_id, la.exec_status from ai_lib_application la inner join application a on a.id = la.application_id where la.ai_control_lib_id = #{libId} " +
            "</script>")
    List<AiLibApplicationEntity> findAppByLibId(@Param("libId") Long libId);
}
